package com.ncp.servlet.order;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ncp.model.biz.order.ManageAddressBiz;
import com.ncp.model.biz.order.ManageOrderBiz;
import com.ncp.model.entity.order.OrderBasic;
import com.ncp.model.entity.order.Receiver;

public class ViewOrderDetailServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;


	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String orderID = request.getParameter("orderID");
		//订单详情
		ManageOrderBiz manageOrderBiz = new ManageOrderBiz();
		OrderBasic order = manageOrderBiz.getOrderByID(orderID);
		
		//订单地址
		ManageAddressBiz manageAddressBiz = new ManageAddressBiz();
		Receiver receiver = manageAddressBiz.getReceiverByID(order.getReceiverID());
		
		request.setAttribute("order", order);
		request.setAttribute("receiver", receiver);
		
		request.getRequestDispatcher("pages/order/vieworderdetail.jsp").forward(request, response);
	}

}
